import { Column, Entity, Index } from "typeorm";
import { BaseEntity } from "../../base/entity/base";

/**
 * 子项分配（司机/导游、车辆）
 */
@Entity('order_assign', { comment: '订单分配' })
export class OrderAssignEntity extends BaseEntity {
    @Index()
    @Column({ comment: '订单ID' })
    orderId: number;

    @Index()
    @Column({ comment: '订单子项ID' })
    itemId: number;

    @Index()
    @Column({ comment: '服务人员ID', nullable: true })
    providerId: number;

    @Index()
    @Column({ comment: '车辆ID', nullable: true })
    vehicleId: number;

    @Column({ comment: '状态 0-未分配 1-已分配 2-已释放', dict: ['未分配', '已分配', '已释放'], default: 0 })
    status: number;

    @Column({ comment: '分配时间', type: 'varchar', length: 30, nullable: true })
    assignedTime: string;

    @Column({
        comment: '执行状态 0-待确认 1-待出发 2-执行中 3-待确认完成 4-已完成 5-已取消',
        dict: ['待确认', '待出发', '执行中', '待确认完成', '已完成', '已取消'],
        default: 0,
    })
    executeStatus: number;

    @Column({ comment: '执行状态更新时间', type: 'varchar', length: 30, nullable: true })
    executeStatusTime: string;

    @Column({ comment: '执行备注', length: 500, nullable: true })
    executeRemark: string;
}


